home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr50 / pbwiz17.zip / DEMO.BAS < prev    next >
BASIC Source File  |  1993-06-05  |  6KB  |  198 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |         PBWIZ  Copyright (c) 1991-1993  Thomas G. Hanlin III         |
  4. '   |                                                                      |
  5. '   |                      PowerBASIC Wizard's Library                     |
  6. '   |                                                                      |
  7. '   +----------------------------------------------------------------------+
  8.  
  9.    $DIM ARRAY
  10.  
  11.    DECLARE FUNCTION CommPorts% ()
  12.    DECLARE FUNCTION Floppies% ()
  13.    DECLARE SUB GetDisplay (INTEGER, INTEGER)
  14.    DECLARE SUB GetDOSv (INTEGER, INTEGER)
  15.    DECLARE SUB GetEMSm (INTEGER, INTEGER)
  16.    DECLARE SUB GetEMSv (INTEGER, INTEGER)
  17.    DECLARE FUNCTION GetExtM& ()
  18.    DECLARE SUB GetXMSm (LONG, LONG)
  19.    DECLARE SUB GetXMSv (INTEGER, INTEGER)
  20.    DECLARE FUNCTION PCDate$ ()
  21.    DECLARE FUNCTION PCType% ()
  22.    DECLARE SUB PopWindow (INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, STRING)
  23.    DECLARE FUNCTION Processor% ()
  24.    DECLARE FUNCTION PrtPorts% ()
  25.    DECLARE SUB XQPrint (STRING, INTEGER, INTEGER, INTEGER)
  26.  
  27.    $LINK "pbwiz.pbl"
  28.  
  29.    DEFINT A-Z
  30.  
  31.  
  32. '  ----- Pick the colors to use -----------------------------------------------
  33.  
  34.  
  35.    GetDisplay Adapter, Mono
  36.  
  37.    IF Mono THEN
  38.       Attr = CalcAttr (7, 0)
  39.    ELSE
  40.       Attr = CalcAttr (7, 1)
  41.    END IF
  42.  
  43.  
  44. '  ----- Clear the screen and pop up the window -------------------------------
  45.  
  46.  
  47.    CLS
  48.  
  49.    Fore = 15
  50.    IF Mono THEN
  51.       Back = 0
  52.    ELSE
  53.       Back = 1
  54.    END IF
  55.    Attr = CalcAttr(Fore, Back)
  56.    Frame = 1
  57.    Grow = 15
  58.    Shade = 0
  59.    Title$ = "PBWiz Demo"
  60.    PopWindow 2, 2, 23, 77, Frame, Attr, Grow, Shade, 10, Title$
  61.  
  62.  
  63. '  ----- Add a text note inside the window ------------------------------------
  64.  
  65.  
  66.    Row = 3
  67.    XQPrint "This is an admittedly trivial demo for the PBWiz library.  I'll", Row, 3, Attr
  68.    Row = Row + 1
  69.    XQPrint "improve it drastically in later versions.  However, for now it will", Row, 3, Attr
  70.    Row = Row + 1
  71.    XQPrint "provide an example of how to access the PBWiz routines.", Row, 3, Attr
  72.    Row = Row + 2
  73.  
  74.  
  75. '  ----- Display processor type -----------------------------------------------
  76.  
  77.  
  78.    SELECT CASE Processor
  79.       CASE 1: St$ = "8088"
  80.       CASE 2: St$ = "80186"
  81.       CASE 3: St$ = "80286"
  82.       CASE 4: St$ = "80386"
  83.       CASE 5: St$ = "80486"
  84.       CASE ELSE: St$ = "80?86"
  85.    END SELECT
  86.    XQPrint "Processor: " + St$, Row, 3, Attr
  87.    Row = Row + 1
  88.  
  89.  
  90. '  ----- Display DOS version --------------------------------------------------
  91.  
  92.  
  93.    GetDOSv MajorV, MinorV
  94.    DOSv$ = STR$(MajorV) + "." + RIGHT$("0" + LTRIM$(STR$(MinorV)), 2)
  95.    St$ = ""
  96.    IF MajorV > 9 THEN St$ = "   OS/2 Compatibility Box"
  97.    IF DRDOS THEN St$ = " (DR DOS)"
  98.    XQPrint "DOS version:" + DOSv$ + St$, Row, 3, Attr
  99.    Row = Row + 1
  100.  
  101.  
  102. '  ----- Display basic equipment info -----------------------------------------
  103.  
  104.  
  105.    XQPrint "Floppy drives:" + STR$(Floppies), Row, 3, Attr
  106.    Row = Row + 1
  107.  
  108.  
  109. '  ----- Display video adapter type -------------------------------------------
  110.  
  111.  
  112.    SELECT CASE Adapter
  113.       CASE 1: St$ = "MDA"
  114.       CASE 2: St$ = "Hercules"
  115.       CASE 3: St$ = "CGA"
  116.       CASE 4: St$ = "EGA"
  117.       CASE 5: St$ = "MCGA"
  118.       CASE 6: St$ = "VGA"
  119.    END SELECT
  120.    IF Mono THEN
  121.       St$ = St$ + " on a monochrome monitor"
  122.    ELSE
  123.       St$ = St$ + " on a color monitor"
  124.    END IF
  125.    XQPrint "Display: " + St$, Row, 3, Attr
  126.    Row = Row + 1
  127.  
  128.  
  129. '  ----- Display BIOS date and type -------------------------------------------
  130.  
  131.  
  132.    XQPrint "ROM BIOS date: " + PCDate$, Row, 3, Attr
  133.    Row = Row + 1
  134.  
  135.    SELECT CASE PCType
  136.       CASE 251, 254, 255: St$ = "PC/XT"
  137.       CASE 253: St$ = "PCjr"
  138.       CASE 252: St$ = "PC AT": ATtype = -1
  139.       CASE 250: St$ = "PS/2 Model 30"
  140.       CASE 249: St$ = "PC Convertible"
  141.       CASE 248: St$ = "PS/2 Model 70 or 80": ATtype = -1
  142.       CASE 45, 154: St$ = "Compaq Portable"
  143.       CASE ELSE: St$ = "unknown"
  144.    END SELECT
  145.    XQPrint "Computer type: " + St$, Row, 3, Attr
  146.    Row = Row + 1
  147.  
  148.  
  149. '  ----- Display extended and expanded memory info ----------------------------
  150.  
  151.  
  152.    IF ATtype THEN
  153.       XQPrint "Extended memory (BIOS):" + STR$(GetExtM&) + " Kbytes", Row, 3, Attr
  154.       Row = Row + 1
  155.    END IF
  156.  
  157.    IF ATtype THEN
  158.       GetXMSv MajorV, MinorV
  159.       GetXMSm LargeBlock&, TotalFree&
  160.       IF MajorV OR MinorV THEN
  161.          St$ = STR$(MajorV) + "." + RIGHT$("0" + LTRIM$(STR$(MinorV)), 2)
  162.          XQPrint "Extended memory (XMS):", Row, 3, Attr
  163.          Row = Row + 1
  164.          XQPrint "   Version:" + St$, Row, 3, Attr
  165.          Row = Row + 1
  166.          XQPrint "   Free   :" + STR$(TotalFree&) + " Kbytes", Row, 3, Attr
  167.          Row = Row + 1
  168.       END IF
  169.    END IF
  170.  
  171.    GetEMSm TotalPages, FreePages
  172.    IF TotalPages THEN
  173.       GetEMSv MajorV, MinorV
  174.       St$ = STR$(MajorV) + "." + RIGHT$("0" + LTRIM$(STR$(MinorV)), 2)
  175.       XQPrint "Expanded memory:", Row, 3, Attr
  176.       Row = Row + 1
  177.       XQPrint "   Version:" + St$, Row, 3, Attr
  178.       Row = Row + 1
  179.       XQPrint "   Total  :" + STR$(TotalPages * 16) + " Kbytes", Row, 3, Attr
  180.       Row = Row + 1
  181.       XQPrint "   Free   :" + STR$(FreePages * 16) + " Kbytes", Row, 3, Attr
  182.       Row = Row + 1
  183.    END IF
  184.  
  185.    St$ = STR$(CommPorts)
  186.    XQPrint "COM ports:" + St$, Row, 3, Attr
  187.    Row = Row + 1
  188.  
  189.    St$ = STR$(PrtPorts)
  190.    XQPrint "LPT ports:" + St$, Row, 3, Attr
  191.    Row = Row + 1
  192.  
  193.  
  194. '  ----- Make sure the DOS prompt doesn't get in the way ----------------------
  195.  
  196.  
  197.    LOCATE 24, 1, 1
  198.